<template>
  <div class="CPT_Island"></div>
</template>
<script>
export default {
  inheritAttrs: false,
  name: "CPT_Island",
  props: {
    test: {
      type: String,
      default: "",
    },
  },
  data() {
    return {}
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      function reload() {
        function h(a) {
          g.body.removeChild(k)
          d.parentElement.removeChild(d)
          t = c = d = k = null
          reload(a)
        }
        var B = true,
          N = false,
          F = 510,
          P = 255,
          U = false,
          Q = true,
          V = true,
          g = document,
          t = g.getElementsByTagName("header")[0],
          k = g.createElement("iframe")
        g.body.appendChild(k)
        var a = k.contentWindow,
          c = k.contentDocument
        c.open()
        c.close()
        c.write(
          B
            ? '<canvas style="display: block;' +
                (Q ? " margin: auto;" : "") +
                '"></canvas>'
            : ""
        )
        // c.write(
        //   '<!doctype html><html style="margin: 0; padding: 0; border: 0;' +
        //     (B ? " w" + "idth: 100%; height: 100%;" : "") +
        //     '"><head><meta charset="utf-8"><body style="margin: 0; padding: 0; border: 0;' +
        //     (B ? " wi" + "dth: 100%; height: 100%;" : "") +
        //     '">' +
        //     (B
        //       ? '<canvas style="display: block;' +
        //         (Q ? " margin: auto;" : "") +
        //         '"></canvas>'
        //       : "") +
        //     ""
        // )
        if (B) {
          var e = c.getElementsByTagName("canvas")[0],
            q = e.style
          c.body.clientWidth
          var l = Math.max(Math.min(F || innerWidth, innerWidth), 1),
            r = Math.max(Math.min(P || innerHeight - 50, innerHeight - 50), 1)
          ;(l < F || r < P) &&
            U &&
            (l < F ? (r = (l / F) * P) : (l = (r / P) * F))
          q.width = (e.width = l) + "px"
          q.height = (e.height = r) + "px"
        }
        V && (a.onorientationchange = h)
        a.AudioContext = a.AudioContext || a.webkitAudioContext
        a.requestAnimationFrame =
          a.requestAnimationFrame ||
          a.mozRequestAnimationFrame ||
          a.webkitRequestAnimationFrame ||
          a.msRequestAnimationFrame ||
          function (b) {
            a.setTimeout(b, 1e3 / 30)
          }
        B &&
          (e.requestPointerLock =
            e.requestPointerLock ||
            e.mozRequestPointerLock ||
            e.webkitRequestPointerLock)
        c.body.requestPointerLock =
          c.body.requestPointerLock ||
          c.body.mozRequestPointerLock ||
          c.body.webkitRequestPointerLock
        var nav = a.navigator
        nav.getUserMedia =
          nav.getUserMedia ||
          N.webkitGetUserMedia ||
          nav.mozGetUserMedia ||
          nav.msGetUserMedia
        a.OscillatorNode &&
          a.OscillatorNode.prototype &&
          ((a.OscillatorNode.prototype.start =
            a.OscillatorNode.prototype.start ||
            a.OscillatorNode.prototype.noteOn),
          (a.OscillatorNode.prototype.stop =
            a.OscillatorNode.prototype.stop ||
            a.OscillatorNode.prototype.noteOff))
        B && (a.a = e)
        a.b = c.body
        a.d = c
        B &&
          (N || (a.c = e.getContext("2d")),
          N &&
            (a.g = (function () {
              a.onorientationchange = a.onresize = null
              try {
                var b = { antialias: !0, stencil: !0 },
                  d =
                    e.getContext("webgl", b) ||
                    e.getContext("experimental-webgl", b)
                a.__glExts =
                  "OES_texture_float OES_texture_float_linear OE" +
                  "S_standard_derivatives EXT_texture_filter_anisotropic MOZ_EXT_texture_filter_anisotropic WEBKIT_EXT_texture_filter_an" +
                  "isotropic WEBGL_compressed_texture_s3tc MOZ_WEBGL_compressed_texture_s3tc WEBKIT_WEBGL_compressed_texture_s3tc"
                    .split(" ")
                    .map(function (a) {
                      return d.getExtension(a)
                    })
              } catch (f) {
                throw (
                  ((c.body.innerHTML = "WebGL not supported."),
                  (a.a = a.b = a.c = a.d = null),
                  f)
                )
              }
              return d
            })()))
        B = c.createElement("script")
        B.textContent = g.querySelector('script[type="demo"]').textContent
        c.body.appendChild(B)
        c.close()
        k.contentWindow.focus()
        B = g.getElementsByTagName("div")[0]
        window.reload = h
        var d = g.createElement("div")
        d.innerHTML = "&#8635;"
        d.className = "button r"
        d.title = "restart just the demo (local, without remot" + "e fetch)"
        d.onclick = h
        t.insertBefore(d, B)
      }
      reload()
    },
  },
}
</script>
<style lang="scss" scoped></style>
